{include file='header.tpl'}
{if $displayProd == true}{include file='left.tpl'}{/if}
<div{if $displayProd} id="left-area"{/if}>
     <div class="breadcrumb">
            <span class="raquo"></span><a href="/">Главная</a>
            <span class="raquo"> &raquo; </span><a href="{geturl route="catalog"}">Каталог</a>   
        {if $kroshki} {foreach from=$kroshki item="cat"}   <span class="raquo"> &raquo; </span><a href="{geturl route="categorylist" cat=$cat->alias}">{$cat->name}</a>   
                {/foreach}{/if}
        </div>
<div class="" >
  <h1 class="category-title">Каталог авторских работ</h1> 
    {if $displayProd}<div class="product-filter">
       
        <div class="sort">Сортировка:      <select onchange="location = this.value;">
                <option value="{if $cat}{else}{geturl action='catalog'}{/if}?sort=date_add&amp;order=DESC{if $type}&type={$type}{/if}" {if $sort=='date_add' && $order=='DESC'}selected="selected"{/if}>По умолчанию</option>
                <option value="{if $cat}{else}{geturl action='catalog'}{/if}?sort=price&amp;order=ASC{if $type}&type={$type}{/if}" {if $sort=='price' && $order=='ASC'}selected="selected"{/if}>Цена (по возрастанию)</option>
                <option value="{if $cat}{else}{geturl action='catalog'}{/if}?sort=price&amp;order=DESC{if $type}&type={$type}{/if}" {if $sort=='price' && $order=='DESC'}selected="selected"{/if}>Цена (по убыванию)</option>
                <option value="{if $cat}{else}{geturl action='catalog'}{/if}?sort=date_add&amp;order=ASC{if $type}&type={$type}{/if}" {if $sort=='date_add' && $order=='ASC'}selected="selected"{/if}>Дата добавления (по возрастанию)</option>
                <option value="{if $cat}{else}{geturl action='catalog'}{/if}?sort=date_add&amp;order=DESC{if $type}&type={$type}{/if}" {if $sort=='date_add' && $order=='DESC'}selected="selected"{/if}>Дата добавления (по убыванию)</option>
            </select>
        </div>
         <div class="type">На странице:      <select onchange="location = this.value;">
                <option value="{if $cat}{else}{geturl action='catalog'}{/if}" >Все работы</option>
                <option value="{if $cat}{else}{geturl action='catalog'}{/if}?type=1" {if $type=='1'}selected{/if}>Готовые работы</option>
                <option value="{if $cat}{else}{geturl action='catalog'}{/if}?type=2" {if $type=='2'}selected{/if}>На заказ</option>
                <option value="{if $cat}{else}{geturl action='catalog'}{/if}?type=3" {if $type=='3'}selected{/if}>Для примера</option>
            
            </select>
        </div>
      <!--  <p>
            <label for="amount">Цена:</label>
            <input type="text" id="amount" style="border: 0; color: #000000; font-weight: bold; background:transparent;" disabled="">
        </p>
        <div id="slider-range" style="float:left;" class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all"><a class="ui-slider-handle ui-state-default ui-corner-all" href="#" style="left: 0%;"></a><a class="ui-slider-handle ui-state-default ui-corner-all" href="#" style="left: 100%;"></a></div>
    -->
    </div>{/if}
                {if !$displayProd}
                <table width="100%"><tr>
    {foreach from=$categories item='cat' name='key'}
        {assign var=tmp_it value=$smarty.foreach.key.iteration}
        {assign var=tmp_it_plus value=$tmp_it+5}
        {if $tmp_it == 1 || $tmp_it_plus %6 == 0}
         <td style="width: 100px; vertical-align: top;"> 
        {/if}
        
            <div style="display: table-row-group; width: 200px; float: left; margin-bottom: 10px;">
            <a href="{geturl route="categorylist" cat=$cat->alias}" style="font-weight: bold;">
                {$cat->name} ({$cat->count})<!--({$cat->getProductsCount()})-->
            </a>
            <br />
            <div style="margin-left: 10px; width: 190px;">
                {foreach from=$cat->child item='subcat'}
                    <a href="{geturl route="categorylistsub" cat=$cat->alias subcat=$subcat->alias}" style="font-size: 13px;line-height: 18px;">
                        {$subcat->name} ({$subcat->count})
                    </a>
                    <br />
                {/foreach}
            </div>
        </div>
        {if $smarty.foreach.key.iteration %6 == 0 || $smarty.foreach.last}
         </td>  
        {/if}
    {/foreach}
     </tr></table>
    {/if}
                {if $displayProd == true}
    {foreach from=$products item=d}
        <div class="main-product">
            <a href="{getsuburl route='shopproduct' name=$d->nameshop action='item' id=$d->getId()}" id="name_{$d->getId()}">
               <img class="img" src="{$d->logo}" alt="{$d->name}" style="width:137px;height:121px;">
                <span class="price-tag"><span class="currency">{$currency}</span>								 
                    {$d->price}        </span>
                                           
            </a>
            <h4 class="title">
                <a href="{getsuburl route='shopproduct' name=$d->nameshop action='item' id=$d->getId()}" id="name_{$d->getId()}">{$d->name}</a>
                <br>
                <a href="{getsuburl route='shop' name=$d->nameshop}" style="font-size:11px;color:#7C7C7C !important;">({$d->nameshop})</a>
            </h4>
            <div class="et-links clearfix">
                <a href="javascript:void();" onclick="addCart({$d->getId()},'cart')" class="add-to-cart et-shop-item">В корзину</a>
                <a href="{getsuburl route='shopproduct' name=$d->nameshop action='item' id=$d->getId()}" id="name_{$d->getId()}" class="more-info">Описание</a>
            </div> <!-- end .et-links -->
           

        </div>
    {/foreach} 
</div>
{if $pages->count_pages > 1}
<div class="wp-pagenavi">
<span class="pages">Страница {$pages->active} из {$pages->count_pages}</span> 
<!-- Previous page link -->
 <a href="{if $cat}?p={$pages->start}{else}{geturl controller="index" action="catalog"}{/if}{if $type}?type={$type}{/if}" class="last">«Первая</a> 
{if $pages->active > '1' }
<a href="?p={$pages->active-1}{if $type}&type={$type}{/if}" >«</a> 
{/if}
<!-- Numbered page links -->
{section name=foo start=$pages->start loop=$pages->end step=1}

{if $smarty.section.foo.index != $pages->active }
<a href="?p={$smarty.section.foo.index}{if $type}&type={$type}{/if}" class="page smaller">{$smarty.section.foo.index}</a> 
{else}
 <span class="current">{$smarty.section.foo.index}</span>
{/if}
{/section}
<!-- Next page link -->
{if $pages->active < $pages->count_pages}
<a href="?p={$pages->active+1}{if $type}&type={$type}{/if}" class="nextpostslink">»</a>
 {/if}
 <a href="?p={$pages->count_pages}{if $type}&type={$type}{/if}" class="last">Последняя»</a> 
 </div>
 {/if}
 {/if}
<div class="botline"></div>

</div>

{include file='footer.tpl'}
 



